// pages/questionnaire/questionnaire.js
var reportList = []

Page({
  /**
   * 页面的初始数据
   */
  data: {
    reportList: [0, 1, 2],
    pageIndex: 0
  },
  // 跳转至问题页面
  url(e) {
    let report = e.currentTarget.dataset.index
    wx.navigateTo({
      url: '../expert/expert?report=' + report
    })
  },
  // 跳转至问题页面
  copy(e) {
    let report = e.currentTarget.dataset.index
    wx.setClipboardData({
      data: e.currentTarget.dataset.url,
      success: function (res) {
        wx.getClipboardData({
          success: function (res) {
            wx.showToast({
              title: '复制链接成功'
            })
          }
        })
      }
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */

  onLoad(options) {
    if (options.pageIndex) {
      this.setData({
        pageIndex: options.pageIndex
      })
      if (options.pageIndex == 0) {
        var reportList = []
        var expert = {}
        expert["name"] = "郭俊杰"
        expert["title"] = "  博士、副教授"
        reportList.push(expert)
        var expert = {}
        expert["name"] = "刘继鑫"
        expert["title"] = "  博士、专业教师"
        reportList.push(expert)
        var expert = {}
        expert["name"] = "张浩  "
        expert["title"] = "  博士后、教授"
        reportList.push(expert)

        this.setData({
          reportList: reportList
        })
      } else if (options.pageIndex == 1) {
        var reportList = []
        var expert = {}
        expert["name"] = "美国寄生虫学家学会"
        expert["url"] = "https://aavp.org/"
        reportList.push(expert)
        var expert = {}
        expert["name"] = "美国疾病控制中心"
        expert["url"] = "https://www.cdc.gov/index.html"
        reportList.push(expert)
        var expert = {}
        expert["name"] = "中国疾病控制中心"
        expert["url"] = "https://www.ipd.org.cn/"
        reportList.push(expert)
        // var expert = {}
        // expert["name"] = "法国Patuer研究所"
        // expert["url"] = "https://www.pasteur.fr/en"
        // reportList.push(expert)

        this.setData({
          reportList: reportList
        })
      }

    }

    // wx.removeStorageSync('questionListFinishStatus')

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {},

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})